package com.zhuss.core.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import com.zhuss.bean.vo.core.role.DetailRoleVo;
import com.zhuss.enums.StartStopEnum;
import com.zhuss.exception.AabException;


@Component("roleCheck")
public class RoleCheck {
	
	@Autowired
	@Qualifier("roleRead")
	private RoleRead roleRead;

	
	public boolean checkStart(Long roleId) throws AabException {
		DetailRoleVo role = ((DetailRoleVo) roleRead.detail(roleId));
		if (StartStopEnum.停用.sameKey(role.getStatus())) {
			return true;
		}
		return false;
	}
	
	public boolean checkStop(Long roleId) throws AabException {
		DetailRoleVo role = ((DetailRoleVo) roleRead.detail(roleId));
		if (StartStopEnum.启用.sameKey(role.getStatus())) {
			return true;
		}
		return false;
	}

}
